﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using PccCommonForC;
public partial class Manager_PrivateInfo_PrivateInfo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
            BindData();
    }

    private void BindData()
    {
            clsWebShop cls = new clsWebShop();

            DataTable dt = cls.Get_UserByUserIDNoneProc(Session["AdminUserID"].ToString()).Tables[0];
            if (dt.Rows.Count > 0)
            {
                txtMenu.Text = dt.Rows[0]["CusNm"].ToString();
                lblUserNm.Text = dt.Rows[0]["UserNm"].ToString();
                lblEmail.Text = dt.Rows[0]["Email"].ToString();
                ddlSex.SelectedItem.Selected = false;
                ddlSex.Items.FindByValue(dt.Rows[0]["sex"].ToString()).Selected = true;
                lblAutNm.Text = dt.Rows[0]["AutNm"].ToString();
            }        
    }


    protected void btnAdd_Click(object sender, EventArgs e)
    {
        PccMsg msg = new PccMsg();
        clsCommon clsCom = new clsCommon();

        msg.CreateFirstNode("UserID", Session["AdminUserID"].ToString());
        msg.CreateFirstNode("CusNm", txtMenu.Text);
        msg.CreateFirstNode("Sex", ddlSex.SelectedValue);
        msg.CreateFirstNode("Status","N");       
        msg.CreateFirstNode("UpdID", "0");

        clsWebShop cls = new clsWebShop();
        cls.Upd_shr_InfUser(msg.GetXmlStr.ToString());
        ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script> alert('Dữ liệu đã cập nhật thành công');</script>");

    }
}
